Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI set-up #26

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Update CI set-up #26

merged 1 commit into from
Mar 7, 2024

Conversation

KevinBrowne
Copy link
Member

@KevinBrowne KevinBrowne commented Mar 4, 2024

Change CI workflow trigger

Change CI workflow to run on PRs. Prior to this, the trigger for a CI
build was a push to the repo. This meant that PRs from forks did not
trigger a CI run, so they could never meet the requirements of the
branch protection rules.

A repo maintainer must approve the workflow run for PRs from external
forks, in order to prevent abuse. This is already configured.

Restrict upload of code coverage report to Code Climate

Restrict the coverage report upload to builds triggered by:

  • pushes to master (these are mainly merges of PRs);

  • pushes of version number tags; and

  • PRs not raised from forks or by Dependabot

PRs from forks or Dependabot do not have access to the secrets needed
to upload the report to Code Climate, and there's no point tainting
their CI builds with failures from the coverage upload.

A few branch protection rules depended on the report being uploaded.
These have been removed so that PRs from forks and Dependabot can
actually pass CI.

Push a tag to set the gem version and build the gem

Pushing a tag of the format vX.Y.Z will trigger a CI test run and then
build the gem and push it to Ruby Gems if the tests pass. The gemspec
will automatically set the version number based on the tag.

This is done in a new job in the CI workflow. This requires access to
a secret but, as the workflow will have been triggered by a push, the
workflow will have access to the secrets in this case.

timlapluie
timlapluie previously approved these changes Mar 5, 2024
@timlapluie timlapluie force-pushed the revise_ci_setup branch 2 times, most recently from 72d8872 to 28ebbaf Compare March 5, 2024 10:27
@KevinBrowne KevinBrowne force-pushed the revise_ci_setup branch 3 times, most recently from 9e9ffb4 to ea716c6 Compare March 5, 2024 17:43
Change CI workflow trigger
--------------------------

Change CI workflow to run on PRs. Prior to this, the trigger for a CI
build was a push to the repo. This meant that PRs from forks did not
trigger a CI run, so they could never meet the requirements of the
branch protection rules.

A repo maintainer must approve the workflow run for PRs from external
forks, in order to prevent abuse. This is already configured.

Restrict upload of code coverage report to Code Climate
-------------------------------------------------------

Restrict the coverage report upload to builds triggered by:

* pushes to master (these are mainly merges of PRs);

* pushes of version number tags; and

* PRs not raised from forks or by Dependabot

PRs from forks or Dependabot do not have access to the secrets needed
to upload the report to Code Climate, and there's no point tainting
their CI builds with failures from the coverage upload.

A few branch protection rules depended on the report being uploaded.
These have been removed so that PRs from forks and Dependabot can
actually pass CI.

Push a tag to set the gem version and build the gem
---------------------------------------------------

Pushing a tag of the format vX.Y.Z will trigger a CI test run and then
build the gem and push it to Ruby Gems if the tests pass. The gemspec
will automatically set the version number based on the tag.

This is done in a new job in the CI workflow. This requires access to
a secret but, as the workflow will have been triggered by a push, the
workflow will have access to the secrets in this case.
Copy link

codeclimate bot commented Mar 6, 2024

Code Climate has analyzed commit c61cf5d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (95% is the threshold).

This pull request will bring the total coverage in the repository to 95.6% (0.0% change).

View more on Code Climate.

Copy link
Member

@timlapluie timlapluie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks Kevin!

@timlapluie timlapluie merged commit 1bd4915 into master Mar 7, 2024
12 checks passed
@timlapluie timlapluie deleted the revise_ci_setup branch March 7, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants